<?php
use app\assets\MaskedInputAsset;
use app\assets\TableAsset;
use yii\helpers\Html;

/**
 * @var $this yii\web\View
 * @var $model_list app\models\ManagerLog[]
 * @var $pagination yii\data\Pagination
 */

MaskedInputAsset::register($this);
TableAsset::register($this);

$this->title = '管理日志';
$this->params['breadcrumbs'][] = '权限管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php echo Html::beginForm('?', 'get', ['class'=>'form-inline']);?>
    <div class="form-group">
        <label for="search_username" class="sr-only">Username</label>
        <input type="text" class="form-control" name="search_username" id="search_username" placeholder="用户名" value="<?php echo Yii::$app->request->get('search_username');?>" />
    </div>
    <div class="form-group">
        <label for="search_start_time" class="sr-only">StartTime</label>
        <input type="text" class="form-control masked" name="search_start_time" id="search_start_time" placeholder="开始时间" value="<?php echo Yii::$app->request->get('search_start_time');?>" data-mask="9999-99-99" />
    </div>
    <div class="form-group">
        <label for="search_end_time" class="sr-only">EndTime</label>
        <input type="text" class="form-control masked" name="search_end_time" id="search_end_time" placeholder="结束时间" value="<?php echo Yii::$app->request->get('search_end_time');?>" data-mask="9999-99-99" />
    </div>
    <div class="form-group">
        <button type="submit" class="btn btn-primary btn-sm">搜索</button>
    </div>
<?php echo Html::endForm();?>
<table id="simple-table" class="table table-striped table-bordered table-hover">
    <thead>
        <tr>
            <th class="center">
                <label class="pos-rel">
                    <input type="checkbox" class="ace" />
                    <span class="lbl"></span>
                </label>
            </th>
            <th>用户名</th>
            <th>操作时间</th>
            <th>IP地址</th>
            <th>操作记录</th>
        </tr>
    </thead>

    <tbody>
        <?php foreach ($model_list as $model) {?>
            <tr>
                <td class="center"><label class="pos-rel"><input type="checkbox" class="ace" value="<?php echo $model->id;?>" /><span class="lbl"><?php echo $model->id;?></span></label></td>
                <td><?php echo Html::a(Html::encode($model->manager->username), '');?></td>
                <td><?php echo Yii::$app->formatter->asDatetime($model->time);?></td>
                <td><?php echo Html::encode($model->ip);?></td>
                <td><?php echo Html::encode($model->content);?></td>
            </tr>
        <?php }?>
    </tbody>
</table>
<?php echo yii\widgets\LinkPager::widget(['pagination'=>$pagination]);?>
